{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5abe2121-5381-46d7-a849-66f921883972",
   "metadata": {},
   "source": [
    "# LangChain 核心模块：Data Conneciton - Text Embedding Models\n",
    "\n",
    "Embeddings类是一个专门用于与文本嵌入模型进行交互的类。有许多嵌入模型提供者（OpenAI、Cohere、Hugging Face等）-这个类旨在为所有这些提供者提供一个标准接口。\n",
    "\n",
    "嵌入将一段文本创建成向量表示。这非常有用，因为它意味着我们可以在向量空间中思考文本，并且可以执行语义搜索等操作，在向量空间中寻找最相似的文本片段。\n",
    "\n",
    "LangChain中基础的Embeddings类公开了两种方法：一种用于对文档进行嵌入，另一种用于对查询进行嵌入。前者输入多个文本，而后者输入单个文本。之所以将它们作为两个独立的方法，是因为某些嵌入提供者针对要搜索的文件和查询（搜索查询本身）具有不同的嵌入方法。\n",
    "\n",
    "\n",
    "![](https://python.langchain.com/v0.1/assets/images/data_connection-95ff2033a8faa5f3ba41376c0f6dd32a.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df8d7408-b14f-4cfb-84c0-9c0bae958cce",
   "metadata": {},
   "source": [
    "### Document 类\n",
    "\n",
    "这段代码定义了一个名为`Document`的类，允许用户与文档的内容进行交互，可以查看文档的段落、摘要，以及使用查找功能来查询文档中的特定字符串。\n",
    "\n",
    "```python\n",
    "# 基于BaseModel定义的文档类。\n",
    "class Document(BaseModel):\n",
    "    \"\"\"接口，用于与文档进行交互。\"\"\"\n",
    "\n",
    "    # 文档的主要内容。\n",
    "    page_content: str\n",
    "    # 用于查找的字符串。\n",
    "    lookup_str: str = \"\"\n",
    "    # 查找的索引，初次默认为0。\n",
    "    lookup_index = 0\n",
    "    # 用于存储任何与文档相关的元数据。\n",
    "    metadata: dict = Field(default_factory=dict)\n",
    "\n",
    "    @property\n",
    "    def paragraphs(self) -> List[str]:\n",
    "        \"\"\"页面的段落列表。\"\"\"\n",
    "        # 使用\"\\n\\n\"将内容分割为多个段落。\n",
    "        return self.page_content.split(\"\\n\\n\")\n",
    "\n",
    "    @property\n",
    "    def summary(self) -> str:\n",
    "        \"\"\"页面的摘要（即第一段）。\"\"\"\n",
    "        # 返回第一个段落作为摘要。\n",
    "        return self.paragraphs[0]\n",
    "\n",
    "    # 这个方法模仿命令行中的查找功能。\n",
    "    def lookup(self, string: str) -> str:\n",
    "        \"\"\"在页面中查找一个词，模仿cmd-F功能。\"\"\"\n",
    "        # 如果输入的字符串与当前的查找字符串不同，则重置查找字符串和索引。\n",
    "        if string.lower() != self.lookup_str:\n",
    "            self.lookup_str = string.lower()\n",
    "            self.lookup_index = 0\n",
    "        else:\n",
    "            # 如果输入的字符串与当前的查找字符串相同，则查找索引加1。\n",
    "            self.lookup_index += 1\n",
    "        # 找出所有包含查找字符串的段落。\n",
    "        lookups = [p for p in self.paragraphs if self.lookup_str in p.lower()]\n",
    "        # 根据查找结果返回相应的信息。\n",
    "        if len(lookups) == 0:\n",
    "            return \"No Results\"\n",
    "        elif self.lookup_index >= len(lookups):\n",
    "            return \"No More Results\"\n",
    "        else:\n",
    "            result_prefix = f\"(Result {self.lookup_index + 1}/{len(lookups)})\"\n",
    "            return f\"{result_prefix} {lookups[self.lookup_index]}\"\n",
    "```\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b68fdbcb-b60d-441f-91fc-d8cac24ba3e1",
   "metadata": {},
   "source": [
    "## 使用 OpenAIEmbeddings 调用 OpenAI 嵌入模型\n",
    "\n",
    "\n",
    "### 使用 embed_documents 方法嵌入文本列表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "8dadd89b-6a13-4391-9102-acde028b61d5",
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_openai import OpenAIEmbeddings"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "24f9c721-dfd3-4632-a89e-92d2fa9b3594",
   "metadata": {},
   "outputs": [],
   "source": [
    "embeddings_model = OpenAIEmbeddings()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "67076c7d-54cc-47a9-a5bd-85570355a7d2",
   "metadata": {},
   "outputs": [],
   "source": [
    "embeddings = embeddings_model.embed_documents(\n",
    "    [\n",
    "        \"Hi there!\",\n",
    "        \"Oh, hello!\",\n",
    "        \"What's your name?\",\n",
    "        \"My friends call me World\",\n",
    "        \"Hello World!\"\n",
    "    ]\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "79e3c50a-efad-49bb-84fc-f0fb2585b34e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(embeddings)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "9e85d4c4-ee77-4470-85ec-ce37f359fdc7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1536"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(embeddings[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "32e3ddc2-9d69-4b72-ace1-800ba94def79",
   "metadata": {},
   "source": [
    "### 使用 embed_query 方法嵌入问题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "0069d18d-1fb6-40e2-974c-2f49559b8b9a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# QA场景：嵌入一段文本，以便与其他嵌入进行比较。\n",
    "embedded_query = embeddings_model.embed_query(\"What was the name mentioned in the conversation?\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "2c3068f7-22b7-4215-99c0-7e47f9a3aa46",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1536"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(embedded_query)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "25339b8d-ee23-460c-ae4e-97a8f24f6add",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0.005377274053424194,\n",
       " -0.0006527779663918577,\n",
       " 0.03898029028341422,\n",
       " -0.0029673974995148614,\n",
       " -0.008834564037682274,\n",
       " 0.02119239807937076,\n",
       " -0.017154494072746107,\n",
       " -0.0017368925528052233,\n",
       " -0.0030053353938687757,\n",
       " -0.010418056571957665,\n",
       " 0.022393211993910672,\n",
       " 0.009157860593078299,\n",
       " 0.003971925383860514,\n",
       " -0.009322808081311317,\n",
       " -0.010154141149578433,\n",
       " 0.002856883026988124,\n",
       " 0.03642031152452607,\n",
       " 0.004321612829568598,\n",
       " 0.020572196790213434,\n",
       " -0.03235601569626669,\n",
       " -0.0032214159887810727,\n",
       " -0.005664282086903142,\n",
       " 0.0015241108191819338,\n",
       " 0.026233180132242902,\n",
       " -0.011434129597699846,\n",
       " 0.019648494208870118,\n",
       " 0.028159762622479028,\n",
       " -0.018421286610050158,\n",
       " -0.0025418342650989486,\n",
       " -0.01682459909628007,\n",
       " 0.011434129597699846,\n",
       " 0.0010465890933763267,\n",
       " -0.014752865312343624,\n",
       " 0.006822210455439958,\n",
       " -0.05090925955184514,\n",
       " -0.003925740161661082,\n",
       " 0.005565313687095597,\n",
       " -0.0178670658063023,\n",
       " 0.0266818355120972,\n",
       " 0.004661404040655659,\n",
       " 0.022775890613646155,\n",
       " 0.001755036697348429,\n",
       " -0.005403665409397585,\n",
       " -0.01794623940856114,\n",
       " -0.0189227256331739,\n",
       " 0.02464968759796751,\n",
       " 0.006653964222333265,\n",
       " 0.007653543523707073,\n",
       " -0.014119468112368935,\n",
       " 0.014251425357897219,\n",
       " 0.0019925604145082714,\n",
       " 0.023937117727056645,\n",
       " -0.009494353059291685,\n",
       " -0.02091528674617417,\n",
       " -0.003698113028368261,\n",
       " 0.024662884440107533,\n",
       " -0.025824111553518023,\n",
       " 0.02554700022032143,\n",
       " -0.0027315232712071887,\n",
       " 0.01537306567017829,\n",
       " 0.019622102387235395,\n",
       " 0.00344409453910205,\n",
       " -0.006729840011041093,\n",
       " 0.0037706898393717494,\n",
       " -0.028793158891131054,\n",
       " 0.016046050602605062,\n",
       " -0.009494353059291685,\n",
       " 0.0056444882206771,\n",
       " -0.004084089228824088,\n",
       " 0.01974086465326898,\n",
       " 0.022591149724848426,\n",
       " 0.028687591604592166,\n",
       " 0.02845006893517032,\n",
       " -0.013947923134388567,\n",
       " -0.0010837021850964898,\n",
       " -0.020321477278651565,\n",
       " -0.006264689044173097,\n",
       " 0.0007455606956922649,\n",
       " -0.011229595308337408,\n",
       " 0.020202715012617976,\n",
       " 0.004697692096911404,\n",
       " -0.021152811278241344,\n",
       " -0.01335411366686596,\n",
       " 0.018328916165651295,\n",
       " 0.015544610648158656,\n",
       " -0.011770622063913232,\n",
       " 0.008385908657827975,\n",
       " 0.016613468248492944,\n",
       " -0.009500950549039034,\n",
       " -0.005614797654168704,\n",
       " 0.015782134248903165,\n",
       " 0.022683520169247292,\n",
       " 0.018012218031325283,\n",
       " 0.00550263380920513,\n",
       " -0.014396579445565527,\n",
       " 0.018368504829426043,\n",
       " -0.004628414263612256,\n",
       " 0.008900543591769079,\n",
       " 0.00030886335331653715,\n",
       " -0.008887347680951717,\n",
       " -0.01287246804430693,\n",
       " 0.015082759357486998,\n",
       " -0.04367798238032563,\n",
       " -0.00552902516517852,\n",
       " -0.0121598972420734,\n",
       " 0.003688216328085906,\n",
       " 0.010167337060395795,\n",
       " -0.0007933953485362008,\n",
       " 0.008959923793463208,\n",
       " -0.011407738707387788,\n",
       " -0.01284607715399487,\n",
       " 0.02410866177371435,\n",
       " 0.010978875796775537,\n",
       " -0.028845940671755173,\n",
       " -0.026510291465439494,\n",
       " -0.008953326303715859,\n",
       " 0.015359869759360928,\n",
       " -0.020374260921921006,\n",
       " -0.008359516836193254,\n",
       " -0.014568124423545895,\n",
       " 0.025652565644214993,\n",
       " 0.01594048331606617,\n",
       " -0.0019925604145082714,\n",
       " 0.005476242453231739,\n",
       " 0.022155689324488827,\n",
       " 0.009276622859111886,\n",
       " -0.022023732078960544,\n",
       " -0.008794977236552853,\n",
       " -0.006729840011041093,\n",
       " -0.0034308988611153547,\n",
       " 0.010107955927379,\n",
       " 0.005057276708563175,\n",
       " 0.012740510798778644,\n",
       " -0.003645330083590814,\n",
       " -0.005176038508935429,\n",
       " 0.02434618630578152,\n",
       " -0.0019777151312540733,\n",
       " 0.0032115192884987175,\n",
       " -0.01123619372940742,\n",
       " -0.009764865971418266,\n",
       " 0.005337686786633443,\n",
       " 0.010945886485393465,\n",
       " 6.628809837479835e-05,\n",
       " 0.012601955132180348,\n",
       " 0.006749633411605803,\n",
       " 0.0434140641639784,\n",
       " 0.004964906264164311,\n",
       " 0.009830844594182408,\n",
       " -0.01142093461820515,\n",
       " -0.00826054890204704,\n",
       " 0.008603638858007776,\n",
       " 0.015241108424650004,\n",
       " 0.017893457627937023,\n",
       " -0.009751670060600905,\n",
       " 0.018381699808920737,\n",
       " 0.009243633547729814,\n",
       " -0.004334808740385959,\n",
       " -0.004964906264164311,\n",
       " -0.005928197043621042,\n",
       " 0.009632907794567318,\n",
       " -0.004737279363702156,\n",
       " 0.015557806558976017,\n",
       " 0.029479338803052525,\n",
       " -0.012859273064812231,\n",
       " 0.008187971858212887,\n",
       " 0.04296540878412411,\n",
       " 0.013109992576374102,\n",
       " 0.0005888610009660957,\n",
       " -0.0007863851082259773,\n",
       " 0.007455607189753315,\n",
       " -0.031986533918671234,\n",
       " 0.017827477142527554,\n",
       " -0.03436177178876166,\n",
       " 0.01682459909628007,\n",
       " 0.014620907135492677,\n",
       " -0.023290524616264595,\n",
       " 0.022208471105112943,\n",
       " -0.020704154035741718,\n",
       " 0.0035991448613913817,\n",
       " -0.014805648024290404,\n",
       " -0.01450214486945909,\n",
       " 0.01539945749181301,\n",
       " 0.008689410881336629,\n",
       " 0.00518263646434411,\n",
       " 0.00048741854250329493,\n",
       " -0.012008145664657742,\n",
       " -0.014554928512728533,\n",
       " -0.02697214368743382,\n",
       " 0.016507900961954057,\n",
       " -0.0027826568435477986,\n",
       " -0.000809477661118027,\n",
       " 0.012951642577888433,\n",
       " 0.002399979620796312,\n",
       " -0.03734401224322406,\n",
       " -0.6794235161760058,\n",
       " -0.05191213759809262,\n",
       " -0.00654839833277837,\n",
       " -0.0029706964772192018,\n",
       " 0.0262463751117376,\n",
       " 0.011011866039480272,\n",
       " -0.000982259726633689,\n",
       " 0.02776388902324885,\n",
       " -0.005007792741490069,\n",
       " 0.03174900938660406,\n",
       " -0.023541244127826464,\n",
       " 0.011341760084623646,\n",
       " -0.011064648751427052,\n",
       " 0.001962870080830541,\n",
       " -0.01776149851976341,\n",
       " -0.020651372255117602,\n",
       " -0.011790415464477942,\n",
       " 0.012991230310340515,\n",
       " -3.672649458942508e-05,\n",
       " -0.005479541198105413,\n",
       " -0.029268206092620076,\n",
       " 0.019516535100696508,\n",
       " -0.0059776814763554805,\n",
       " -0.005763250021049355,\n",
       " 0.01214670133125604,\n",
       " 0.0004952535272396034,\n",
       " 0.0065912843444427965,\n",
       " -0.02776388902324885,\n",
       " -0.021073635813337176,\n",
       " 0.0060469593096546285,\n",
       " -0.03726483864096522,\n",
       " 0.00713231063435729,\n",
       " 0.03254075658506442,\n",
       " -0.001634625291708671,\n",
       " 0.04193614077888723,\n",
       " 0.005275006908742975,\n",
       " -0.011440728018769858,\n",
       " 0.021509096213696777,\n",
       " -0.008095601413814022,\n",
       " 0.020295085457016842,\n",
       " -0.022828672394270274,\n",
       " 0.010253109083724647,\n",
       " 0.018368504829426043,\n",
       " -0.007976840079103098,\n",
       " 0.0032527559277263063,\n",
       " 0.005684075487467852,\n",
       " 0.031405921293288654,\n",
       " 0.01956931874396595,\n",
       " -0.018513657054449024,\n",
       " -0.015465436114577152,\n",
       " 0.009078686059496795,\n",
       " -0.0036783193949728853,\n",
       " -0.009362394882440736,\n",
       " 0.0033286317164341354,\n",
       " 0.005588406298195313,\n",
       " 0.006043660099119622,\n",
       " 0.03130035400674976,\n",
       " -0.015439044292942431,\n",
       " 0.005888609776830291,\n",
       " -0.018737986607021497,\n",
       " -0.0002082456538317381,\n",
       " 0.024768449864001098,\n",
       " -0.012654737844127129,\n",
       " -0.007343442879128409,\n",
       " -0.01007496661599693,\n",
       " 0.017999023051830584,\n",
       " -0.017853868964162276,\n",
       " 0.016257181450392184,\n",
       " 0.029901602361272102,\n",
       " -0.024451751729675085,\n",
       " 0.019727667811128956,\n",
       " 0.015597393360105438,\n",
       " -0.021931361634561677,\n",
       " 0.0009789607489293487,\n",
       " -0.002403278598500652,\n",
       " 0.003193375027540179,\n",
       " 0.006264689044173097,\n",
       " 0.006324070177189891,\n",
       " 0.016375943716425773,\n",
       " -0.005641189475803426,\n",
       " -0.005453149842132023,\n",
       " -0.00893353290315115,\n",
       " -0.01931859923240408,\n",
       " -5.34144970490533e-06,\n",
       " 0.024121858615854374,\n",
       " -0.010431251551452362,\n",
       " -0.01634955189479105,\n",
       " -0.00035071868183093934,\n",
       " 0.001679161025055933,\n",
       " -0.02340928688229818,\n",
       " 0.007125712678948609,\n",
       " 0.0035199703278098785,\n",
       " -0.002198744309138213,\n",
       " -0.005106761141297613,\n",
       " -0.00039690384582270505,\n",
       " 0.022050122037949937,\n",
       " -0.012496388776964122,\n",
       " 0.005357480652859484,\n",
       " 0.009487754638221673,\n",
       " -0.01012774932794371,\n",
       " 0.024689276261742256,\n",
       " -0.012483193797469426,\n",
       " 0.030218300495598115,\n",
       " 0.0009237035126659802,\n",
       " 0.012423812664452631,\n",
       " -0.006637469566642229,\n",
       " -0.03478403720962656,\n",
       " 0.02866120164560277,\n",
       " 0.03227684209400785,\n",
       " -0.010411458150887653,\n",
       " 0.013169372778068232,\n",
       " -0.01105805033035704,\n",
       " 0.004153367062123236,\n",
       " -0.01681140411678537,\n",
       " -0.022736301949871408,\n",
       " -0.02610122288671462,\n",
       " 0.0413291344692246,\n",
       " 0.0016808105139081032,\n",
       " -0.00806261210243195,\n",
       " -0.010101357506308988,\n",
       " 0.006653964222333265,\n",
       " 0.002393381898218297,\n",
       " -0.004443673840475859,\n",
       " -0.014449362157512309,\n",
       " 0.027499972669546954,\n",
       " -0.004806557197001304,\n",
       " 0.0020140036531711503,\n",
       " -0.009540538281491116,\n",
       " -0.00472078470801112,\n",
       " 0.013763182245590838,\n",
       " 0.013749986334773477,\n",
       " -0.018434483452190183,\n",
       " 0.011856394087242084,\n",
       " -0.012727314887961284,\n",
       " 0.02461010079683809,\n",
       " -0.007534781723334818,\n",
       " 0.020163128211488558,\n",
       " -0.012206082464272832,\n",
       " 0.011605674575680213,\n",
       " -0.00965929961620204,\n",
       " -0.03937616201999908,\n",
       " 0.003698113028368261,\n",
       " 0.027526364491181676,\n",
       " 0.00355295963919195,\n",
       " -0.010187130460960503,\n",
       " -0.03425620450222277,\n",
       " 0.0014193693830147928,\n",
       " 0.00257812255418536,\n",
       " -0.03723844868197582,\n",
       " -0.0014243178495713033,\n",
       " 0.02969046965083965,\n",
       " -0.019410969676802944,\n",
       " -0.012476595376399413,\n",
       " 0.02040065274355573,\n",
       " 0.00415006785158823,\n",
       " -0.008451887280592117,\n",
       " -0.016798209137290673,\n",
       " -0.04241118611773092,\n",
       " -0.002098126536893831,\n",
       " -0.031194786720210876,\n",
       " -0.0013888542467033105,\n",
       " 0.019701275989494234,\n",
       " -0.009626310304819969,\n",
       " -0.011321965752736272,\n",
       " 0.021429922611437936,\n",
       " 0.0013138032606292331,\n",
       " 0.017814282163032855,\n",
       " -0.00379708119534514,\n",
       " -0.007152104500583332,\n",
       " -0.020690959056247023,\n",
       " 0.01671903367238651,\n",
       " -0.011816807286112665,\n",
       " -0.013393701399318045,\n",
       " 0.01898870611858337,\n",
       " 0.01219948404320282,\n",
       " 0.0013047312465652968,\n",
       " -0.013749986334773477,\n",
       " -0.03415063721568388,\n",
       " 0.006776025233240526,\n",
       " 0.0007517461915764033,\n",
       " -0.007844881902252151,\n",
       " 0.025111539819961833,\n",
       " -0.010266304994542008,\n",
       " 0.0034605891947930853,\n",
       " 0.022380017014415974,\n",
       " -0.02131116034540435,\n",
       " 0.014673689847439457,\n",
       " 0.03520629890520081,\n",
       " -0.002842037743733926,\n",
       " 0.03713288139543693,\n",
       " -0.009553733260985815,\n",
       " 0.010794135839300471,\n",
       " -0.01123619372940742,\n",
       " -0.005713766053976248,\n",
       " 0.01815737211899359,\n",
       " -0.0013533906438353178,\n",
       " 0.02315856737073631,\n",
       " 0.014449362157512309,\n",
       " 0.013380505488500683,\n",
       " 0.011321965752736272,\n",
       " 0.011506706641534,\n",
       " 0.029664079691850254,\n",
       " 0.03309497925145761,\n",
       " -0.012014744085727754,\n",
       " 0.013011023710905225,\n",
       " -0.01898870611858337,\n",
       " -0.0037080099614812817,\n",
       " -0.03821493304394326,\n",
       " 0.01950334012120181,\n",
       " -0.009045696748114724,\n",
       " 0.01127578053053684,\n",
       " -0.00969228892758411,\n",
       " 0.009527342370673757,\n",
       " -0.011777219553660581,\n",
       " -0.006743035921858455,\n",
       " -0.0027958525215344937,\n",
       " -0.006594583554977803,\n",
       " 0.024808036665130515,\n",
       " -0.013156177798573535,\n",
       " 0.012595357642432999,\n",
       " 0.02311898056960689,\n",
       " 0.0047471765296458425,\n",
       " 0.003107602538549995,\n",
       " -0.009303013749423944,\n",
       " -0.03655226877005435,\n",
       " 0.0007637048984431371,\n",
       " 0.029294597914254795,\n",
       " 0.011513305062604012,\n",
       " -0.004512951673775007,\n",
       " 0.001049888071080667,\n",
       " 7.360762512076196e-05,\n",
       " 0.006617676166077519,\n",
       " 0.02371278817448417,\n",
       " 0.0063900487999540324,\n",
       " 0.0019694678034085553,\n",
       " -0.008841162458752286,\n",
       " 0.012535976509416206,\n",
       " -0.01288566395512429,\n",
       " 0.038267716687212704,\n",
       " -0.023145370528596287,\n",
       " 0.002616060448539274,\n",
       " 0.004915422297091204,\n",
       " 0.015993266959335617,\n",
       " -0.01060279652943273,\n",
       " 0.03346445730376241,\n",
       " -0.011928971131076238,\n",
       " 0.0018292628807887548,\n",
       " -0.0073632367453544505,\n",
       " -0.014713277579891541,\n",
       " 0.0039059462954350397,\n",
       " -0.012166494731820748,\n",
       " -0.01745799722757742,\n",
       " -0.021179203099876066,\n",
       " -0.0049451128635996005,\n",
       " -0.002070085575652938,\n",
       " -0.0024280205820372052,\n",
       " -0.014093076290734212,\n",
       " 0.008860955859316996,\n",
       " -0.010879907862629323,\n",
       " 0.031405921293288654,\n",
       " 0.005611498909295029,\n",
       " -0.02438577310691094,\n",
       " 0.016455119181329938,\n",
       " 0.00021669919688761038,\n",
       " -0.002076683531061618,\n",
       " -0.007099321322975219,\n",
       " 0.010167337060395795,\n",
       " 0.007310453567746338,\n",
       " 0.002733172643644026,\n",
       " -0.03280467107612099,\n",
       " 0.016732228651881204,\n",
       " -0.010292696816176729,\n",
       " 0.013723595444461419,\n",
       " 0.010866711951811962,\n",
       " 0.0029410061435414707,\n",
       " 0.009197448325530383,\n",
       " -0.009415178525710182,\n",
       " -0.020136736389853836,\n",
       " -0.020004779144325552,\n",
       " 0.002198744309138213,\n",
       " -0.0016601921942943087,\n",
       " -0.028977899779928783,\n",
       " 0.006522006511143649,\n",
       " 0.006762829322423164,\n",
       " -0.011110833973626484,\n",
       " 0.003041623682955187,\n",
       " 0.005858919675983226,\n",
       " -0.0005463871577878795,\n",
       " -0.016877382739549515,\n",
       " 0.015623785181740159,\n",
       " -0.005387170753706549,\n",
       " 0.03863719846480816,\n",
       " -0.009547135771238465,\n",
       " 0.00711251723379258,\n",
       " 0.00621520507709999,\n",
       " 0.01333432026630125,\n",
       " 0.008854358369569647,\n",
       " 0.002757914860011245,\n",
       " 0.02182579434802279,\n",
       " -0.0075875644352816,\n",
       " 0.009177653993643009,\n",
       " 0.023039805104702722,\n",
       " -0.02294743466030386,\n",
       " 0.012951642577888433,\n",
       " 0.03713288139543693,\n",
       " 0.0038267717618535365,\n",
       " 0.004235840340578414,\n",
       " -0.02398989950768076,\n",
       " 0.001984313086662754,\n",
       " -0.029532120583676644,\n",
       " 0.01678501229515065,\n",
       " -0.02149590123420208,\n",
       " -0.007712924656723867,\n",
       " -0.023937117727056645,\n",
       " 0.018685202963752055,\n",
       " 0.00893353290315115,\n",
       " -0.0210868326554772,\n",
       " 0.007099321322975219,\n",
       " 0.035232692589480856,\n",
       " -0.00480325845212763,\n",
       " -0.013505865244281618,\n",
       " -0.0318281829888629,\n",
       " -0.019925603679421384,\n",
       " -0.002051941314694399,\n",
       " 0.1041409770558019,\n",
       " 0.022894651017034414,\n",
       " -0.0008090653180088177,\n",
       " 0.016402335538060496,\n",
       " 0.012212679954020181,\n",
       " -0.008432093880027408,\n",
       " -0.03879554939461649,\n",
       " -0.020110344568219113,\n",
       " 0.019899213720431987,\n",
       " -0.01923942563014524,\n",
       " -0.0025286383542815873,\n",
       " -0.010246511593977298,\n",
       " 0.01819695892012301,\n",
       " -0.009190849904460369,\n",
       " 0.009910019127763911,\n",
       " -0.004249036251395775,\n",
       " -0.0013047312465652968,\n",
       " -0.012806489421542788,\n",
       " 0.011354955064118342,\n",
       " -0.04008873189090994,\n",
       " 0.0003150488783045087,\n",
       " 0.013466277511829536,\n",
       " 0.002591318232172055,\n",
       " 0.009929812528328622,\n",
       " -0.02587689519678747,\n",
       " 0.0018325618584930949,\n",
       " 0.018949117454808623,\n",
       " 0.027130492754596825,\n",
       " 0.033121369210447005,\n",
       " -0.021443117590932634,\n",
       " 0.014106272201551574,\n",
       " -5.53088118938321e-05,\n",
       " -0.0029047176216243937,\n",
       " -0.020559001810718736,\n",
       " 0.0036288351950691127,\n",
       " 0.006973961567194284,\n",
       " -0.007844881902252151,\n",
       " 0.00944156941602224,\n",
       " 0.00211956977555671,\n",
       " -0.017497584028706843,\n",
       " 0.004235840340578414,\n",
       " 0.010233315683159936,\n",
       " 0.004136872406432201,\n",
       " 0.003740999272863353,\n",
       " 0.02073054585737644,\n",
       " -0.026088026044574594,\n",
       " 0.0256261756852256,\n",
       " 0.012575563310545625,\n",
       " -0.000767828562365896,\n",
       " 0.0034836818058928015,\n",
       " 0.022775890613646155,\n",
       " 0.002886573593496521,\n",
       " -0.018645616162622634,\n",
       " -0.002169053742629817,\n",
       " -0.004225943640296059,\n",
       " 0.0016329759192718338,\n",
       " 0.004978102174981671,\n",
       " -0.01852685389658905,\n",
       " -0.011203204418025348,\n",
       " 0.026325550576641765,\n",
       " -0.019252620609639937,\n",
       " -0.026365137377771186,\n",
       " -0.0030944068605633,\n",
       " -0.007547977168490848,\n",
       " -0.022525171102084282,\n",
       " -0.029057073382187625,\n",
       " 0.014660494867944759,\n",
       " -0.023541244127826464,\n",
       " -0.023686398215494772,\n",
       " 0.019912408699926686,\n",
       " 0.0009171056154649661,\n",
       " 0.012041134976039813,\n",
       " -0.04412663776017992,\n",
       " 0.016507900961954057,\n",
       " 0.036156393308178846,\n",
       " 0.0034935787390058225,\n",
       " 0.015254304335467365,\n",
       " -0.011328564173806285,\n",
       " -0.005222223731134862,\n",
       " -0.0026391528268083246,\n",
       " 0.015333478869048869,\n",
       " -0.02313217554910159,\n",
       " 0.01038506632925293,\n",
       " -0.00759416239069028,\n",
       " -0.0037146076840592966,\n",
       " 0.003694814050663921,\n",
       " 0.008768585414918132,\n",
       " 0.014581320334363256,\n",
       " -0.019912408699926686,\n",
       " -0.002030498308862186,\n",
       " 0.004578930296539149,\n",
       " 0.009560331682055827,\n",
       " 0.03776627766408896,\n",
       " -0.02718327453522094,\n",
       " 0.009923215038581273,\n",
       " 0.009791257793052987,\n",
       " -0.015993266959335617,\n",
       " 0.03338528370150357,\n",
       " 0.00584242502029219,\n",
       " -0.014963997091453412,\n",
       " -0.007739316012697257,\n",
       " -0.036974534190919256,\n",
       " -0.0037574939285543885,\n",
       " -0.0008841162458752285,\n",
       " -0.00404120275149833,\n",
       " 0.00448326110726661,\n",
       " 0.0046778986963466945,\n",
       " 0.010497231105539169,\n",
       " 0.004763671185336878,\n",
       " 0.005651086176085781,\n",
       " 0.017048928648852546,\n",
       " -0.02102085217006773,\n",
       " -0.009118273791948878,\n",
       " -0.008220961169594957,\n",
       " 0.00944156941602224,\n",
       " 0.024478143551309808,\n",
       " 0.005116657841579968,\n",
       " 0.03240879933953614,\n",
       " -0.009751670060600905,\n",
       " -0.02293423968080916,\n",
       " 0.011876188419129458,\n",
       " -0.03351724094703185,\n",
       " 0.0023801859874009357,\n",
       " 0.013261743222467096,\n",
       " -0.03132674396573916,\n",
       " 0.01175742615309587,\n",
       " 0.006300977566090174,\n",
       " -0.025797719731883304,\n",
       " -0.019714472831634258,\n",
       " 0.002030498308862186,\n",
       " 0.006518707766269974,\n",
       " 0.018012218031325283,\n",
       " -7.793748242600042e-05,\n",
       " -0.028133370800844305,\n",
       " -0.004301819429003888,\n",
       " -0.025190715284865998,\n",
       " 0.01605924558209976,\n",
       " -0.00608654657644538,\n",
       " -0.008023025301302531,\n",
       " -0.008630029748319834,\n",
       " -0.02323774097299515,\n",
       " -0.02131116034540435,\n",
       " -0.0211000276349719,\n",
       " -0.0017913251028501731,\n",
       " -0.020295085457016842,\n",
       " -0.023976704528186066,\n",
       " -0.02091528674617417,\n",
       " 0.017418408563802674,\n",
       " -0.013228753911085026,\n",
       " 0.03692175054764981,\n",
       " 0.0009055593681227745,\n",
       " 0.01840809163055546,\n",
       " -0.0022135895923924118,\n",
       " 0.01353885455566369,\n",
       " -0.0012494740103019283,\n",
       " -0.036024436062650565,\n",
       " -0.013030817111469936,\n",
       " -0.0073632367453544505,\n",
       " 0.025969265641186335,\n",
       " -0.002649049759921345,\n",
       " 0.02206331888008996,\n",
       " 0.01566337198286958,\n",
       " 0.028397285291900876,\n",
       " 0.0072246810787561545,\n",
       " 0.0018160670863867265,\n",
       " 0.005020988652307429,\n",
       " -0.008333125014558532,\n",
       " -0.01149351073071664,\n",
       " -0.01098547421784555,\n",
       " 0.001026795459980951,\n",
       " 0.021363942126028466,\n",
       " 0.0017072021027121594,\n",
       " 0.039085853844662455,\n",
       " 0.008385908657827975,\n",
       " -0.014554928512728533,\n",
       " 0.006198710421408955,\n",
       " 0.027156882713586218,\n",
       " 0.02503236621770299,\n",
       " -0.013961119045205929,\n",
       " -0.01629677011416693,\n",
       " -0.01888313883204448,\n",
       " -0.011625468907567587,\n",
       " -0.005697271398285213,\n",
       " 0.0022762694702828795,\n",
       " 0.00038803794510570684,\n",
       " -0.019912408699926686,\n",
       " 0.020123541410359137,\n",
       " 0.007910860525016293,\n",
       " -0.002018952003312328,\n",
       " -0.02515112662109125,\n",
       " 0.028872332493389895,\n",
       " -0.011117431463373833,\n",
       " 0.017312843139909113,\n",
       " 0.007053136100775787,\n",
       " -0.006106339977010091,\n",
       " -0.02364680955172003,\n",
       " -1.1849126387147146e-05,\n",
       " -0.000814426069466871,\n",
       " 0.003929038906534756,\n",
       " 0.016178007848133346,\n",
       " -0.006769427277831845,\n",
       " 0.013512462734028967,\n",
       " -0.009481157148474324,\n",
       " 0.002480803759645318,\n",
       " 0.008643225659137195,\n",
       " 0.021984143415185797,\n",
       " 0.008432093880027408,\n",
       " 0.007897665545521595,\n",
       " 0.002215238964829249,\n",
       " 0.001911736392074598,\n",
       " -0.02631235559714707,\n",
       " -0.0030531699885050453,\n",
       " -0.03232962201198664,\n",
       " 0.001766583002898287,\n",
       " 0.0024676080816586226,\n",
       " 0.0009583424293155543,\n",
       " -0.010167337060395795,\n",
       " 0.017207277716015552,\n",
       " 0.00108535167394866,\n",
       " -0.019344991054038804,\n",
       " -0.01538626158099565,\n",
       " 0.007943850767721028,\n",
       " 0.01815737211899359,\n",
       " 0.009045696748114724,\n",
       " 0.02958490422694609,\n",
       " -0.01101846352922762,\n",
       " -0.007125712678948609,\n",
       " -0.023528049148331766,\n",
       " 0.006640768777177235,\n",
       " -0.0015768938803747137,\n",
       " -0.009276622859111886,\n",
       " 0.03240879933953614,\n",
       " 0.019859625056657244,\n",
       " -0.006399945965897719,\n",
       " -0.02319815417186573,\n",
       " 0.0005698921119968049,\n",
       " 0.023013413283068,\n",
       " -0.025124736662101858,\n",
       " -0.04270149429306754,\n",
       " 0.014898018468689269,\n",
       " 0.023013413283068,\n",
       " -0.001228855574272801,\n",
       " -0.006881591122795419,\n",
       " -0.0029673974995148614,\n",
       " 0.005829229109474829,\n",
       " 0.009817648683365047,\n",
       " 0.0033335800665753126,\n",
       " -0.005486139153514094,\n",
       " -0.0003418527811139411,\n",
       " -0.0025533805706488065,\n",
       " -0.0002903068074564557,\n",
       " -0.00849807250279155,\n",
       " 0.002183899025884015,\n",
       " 0.029162640668726512,\n",
       " 0.00048453199521966364,\n",
       " -0.019450556477932365,\n",
       " -0.0015241108191819338,\n",
       " -0.009283220348859233,\n",
       " 0.0059578876101294385,\n",
       " 0.013499266823211606,\n",
       " -0.02201053523682052,\n",
       " 0.016257181450392184,\n",
       " -0.015333478869048869,\n",
       " 0.005301398264716365,\n",
       " -0.01245020355476469,\n",
       " 0.0021344148259802424,\n",
       " -0.02091528674617417,\n",
       " 0.0029772944326278824,\n",
       " 0.015043171625034915,\n",
       " 0.02311898056960689,\n",
       " 0.007079527922410509,\n",
       " -0.00482964980810102,\n",
       " -0.00552902516517852,\n",
       " -0.024332989463641496,\n",
       " 0.01629677011416693,\n",
       " 0.00016803981416950607,\n",
       " 0.007897665545521595,\n",
       " -0.007297257656928977,\n",
       " -0.00873559610353606,\n",
       " -0.016850990917914793,\n",
       " 0.029109857025457066,\n",
       " 0.009632907794567318,\n",
       " 0.005057276708563175,\n",
       " -0.00019061693817504406,\n",
       " -0.008484876591974189,\n",
       " -0.011170215106643278,\n",
       " -0.026180396488973457,\n",
       " -0.017497584028706843,\n",
       " 0.002898119899046379,\n",
       " -0.023382895060663458,\n",
       " -0.04066934824158318,\n",
       " -0.02847646075680504,\n",
       " 0.02731523364339455,\n",
       " 0.007561173079308209,\n",
       " -0.01630996509366163,\n",
       " -0.010239913172907286,\n",
       " 0.013749986334773477,\n",
       " 0.012535976509416206,\n",
       " -0.03251436290078437,\n",
       " 0.02014993323199386,\n",
       " -0.009817648683365047,\n",
       " 0.00023113206427301632,\n",
       " -0.009322808081311317,\n",
       " 0.018289329364521874,\n",
       " 0.01764273811637515,\n",
       " -0.024412164928545664,\n",
       " 0.03758153677529123,\n",
       " -0.017022536827217823,\n",
       " -0.024425359908040362,\n",
       " -0.016982948163443076,\n",
       " 0.005964485565538119,\n",
       " 0.01583491789217261,\n",
       " 0.014013901757152709,\n",
       " -0.007950448257468377,\n",
       " 0.002149260109234441,\n",
       " 0.0034968777167101624,\n",
       " -0.007297257656928977,\n",
       " -0.018540048876083747,\n",
       " 0.0035265680503878934,\n",
       " 0.02293423968080916,\n",
       " 0.0005863867676878404,\n",
       " -0.004070893318006727,\n",
       " 0.016798209137290673,\n",
       " -0.007178495856556722,\n",
       " -0.015689763804504302,\n",
       " 0.015900896514936754,\n",
       " -0.000964940268308902,\n",
       " 0.0066110782106688385,\n",
       " -0.03718566503870638,\n",
       " 0.009560331682055827,\n",
       " -0.0038498643729532526,\n",
       " 0.002886573593496521,\n",
       " 0.017418408563802674,\n",
       " -0.017827477142527554,\n",
       " -0.012819685332360149,\n",
       " -0.013453081601012174,\n",
       " -0.016098832383229178,\n",
       " 0.020862503102904724,\n",
       " 0.007218083123347474,\n",
       " -0.0033616210278162063,\n",
       " -0.015056367535852275,\n",
       " 0.019859625056657244,\n",
       " 0.005176038508935429,\n",
       " 0.01861922434098791,\n",
       " 0.01055001381748595,\n",
       " -0.013169372778068232,\n",
       " -0.011190008507207987,\n",
       " -0.026325550576641765,\n",
       " -0.04747835999223778,\n",
       " -0.015623785181740159,\n",
       " -0.0004202026284770258,\n",
       " 0.003038324705250847,\n",
       " -0.0015612239109020968,\n",
       " -0.025098344840467135,\n",
       " -0.027104100932962102,\n",
       " 1.8765949304416857e-06,\n",
       " -0.015201520692197922,\n",
       " 0.0019364784920264844,\n",
       " 0.014159055844821017,\n",
       " -0.01080733081879517,\n",
       " 0.0005995825620898687,\n",
       " -0.0019810141089584136,\n",
       " -0.015900896514936754,\n",
       " 0.010741352196031027,\n",
       " -0.010140945238761072,\n",
       " -0.0036783193949728853,\n",
       " -0.008583844526120403,\n",
       " -0.011229595308337408,\n",
       " 0.0008234981999461402,\n",
       " -0.024596905817343393,\n",
       " 0.013552050466481051,\n",
       " 0.006617676166077519,\n",
       " -0.007053136100775787,\n",
       " 0.006370255399389322,\n",
       " -0.009837442083929757,\n",
       " 0.005020988652307429,\n",
       " 0.013090198244486729,\n",
       " -0.0030020364161644354,\n",
       " -0.023686398215494772,\n",
       " 0.009507548038786383,\n",
       " -0.009863833905564478,\n",
       " 0.007679934879680464,\n",
       " 0.0008317455277916581,\n",
       " 0.025296280708759562,\n",
       " -0.007864675302816862,\n",
       " -0.029426555159783083,\n",
       " 0.00293110921042845,\n",
       " -0.003150488783045087,\n",
       " 0.014554928512728533,\n",
       " -0.038953896599134175,\n",
       " -0.015689763804504302,\n",
       " 0.0009129819515422072,\n",
       " 0.004697692096911404,\n",
       " 0.014317404911984024,\n",
       " -0.007435813323527274,\n",
       " -0.008056014612684601,\n",
       " 0.018315721186156597,\n",
       " -0.0027909041713933165,\n",
       " 0.01036527292868822,\n",
       " -0.008240754570159667,\n",
       " -0.015452240203759793,\n",
       " 0.008946728813968512,\n",
       " -0.026140809687844036,\n",
       " -0.006419739366462429,\n",
       " 0.0011373099325076882,\n",
       " 0.019147055185746376,\n",
       " -0.02206331888008996,\n",
       " -0.016560684605223502,\n",
       " 0.03135313765001921,\n",
       " -0.033147759169436394,\n",
       " -0.0072576703901382255,\n",
       " -0.02255156106107368,\n",
       " -0.01123619372940742,\n",
       " -0.039560902908796804,\n",
       " -0.008874151770134356,\n",
       " -0.0016585427054421386,\n",
       " -0.007904263035268944,\n",
       " -0.02373917999611889,\n",
       " 0.011678251619514367,\n",
       " -2.6906988586734765e-05,\n",
       " -0.014079881311239514,\n",
       " 0.0009723629099360011,\n",
       " -0.022775890613646155,\n",
       " -0.006456027888379506,\n",
       " -0.002993789088318918,\n",
       " -0.003391311594324603,\n",
       " 0.0015455539414294798,\n",
       " -0.027156882713586218,\n",
       " -0.008979718125350582,\n",
       " 0.03591887250140233,\n",
       " -0.024781646706141122,\n",
       " -0.018777573408150918,\n",
       " 0.015966875137700894,\n",
       " 0.010688569484084245,\n",
       " -0.0015834917193680612,\n",
       " 0.022393211993910672,\n",
       " 0.21936639253830492,\n",
       " 0.013512462734028967,\n",
       " -0.01819695892012301,\n",
       " 0.030139126893339273,\n",
       " 0.0021773010704753343,\n",
       " 0.0131231875558688,\n",
       " 0.015491827936211875,\n",
       " 0.01745799722757742,\n",
       " 0.01241061675363527,\n",
       " 0.031010047694058473,\n",
       " -0.02606163422293987,\n",
       " -0.008438691369774758,\n",
       " -0.010932690574576104,\n",
       " 0.0019810141089584136,\n",
       " 0.023950312706551343,\n",
       " -0.028555634359063883,\n",
       " -0.031617052141075776,\n",
       " -0.022129297502854105,\n",
       " -0.0015067913608571468,\n",
       " -0.0312211785418456,\n",
       " 0.019648494208870118,\n",
       " 0.0032131686609355547,\n",
       " -0.007376432656171812,\n",
       " -0.015478632025394514,\n",
       " 0.026734619155366644,\n",
       " 0.04357241509378674,\n",
       " 0.010338882038376162,\n",
       " 0.01996519234319613,\n",
       " -0.0060469593096546285,\n",
       " 0.002513793071027389,\n",
       " -0.01359163726761047,\n",
       " 0.000785148020690683,\n",
       " -0.010787537418230459,\n",
       " 0.0019595711031262005,\n",
       " -0.014291013090349303,\n",
       " -0.012166494731820748,\n",
       " 0.0031026541884088175,\n",
       " -0.0014622556275098847,\n",
       " 0.006907982944430141,\n",
       " -0.002921212510146095,\n",
       " -0.004232541595704739,\n",
       " -0.017537170829836263,\n",
       " -0.02504556119719769,\n",
       " 0.0009154561848204624,\n",
       " -0.003688216328085906,\n",
       " 0.013479473422646895,\n",
       " ...]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "embedded_query"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
